from apps.merchant.cate.baseViews import *


class CateTreeViewSet(BaseCateViewSet):
    authentication_classes = []
    permission_classes = []
    def get_queryset(self):
        params = getRequestParams(self.request)
        _lists = CateDao().findAll()
        parentId = params.get('parentId')
        if parentId:
            _lists = _lists.filter(parent=parentId)
        else:
            _lists = _lists.filter(parent__isnull=True)
        return _lists
    
class CateViewSet(BaseCateViewSet):
    authentication_classes = []
    permission_classes = []
    def get_queryset(self):
        params = getRequestParams(self.request)
        _list = CateDao().findAll()
        return _list.order_by('id')
